﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="clr-namespace:UTable.Objects.Controls">
    <Style TargetType="{x:Type local:UObject}">
        <Setter Property="BorderBrush" Value="#33000000"/>
        <Setter Property="Foreground" Value="#FF515151"/>
        <Setter Property="BorderThickness" Value="1"/>
        <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
        <Setter Property="VerticalContentAlignment" Value="Stretch"/>
        <Setter Property="MinWidth" Value="48"/>
        <Setter Property="MinHeight" Value="48"/>
        <Setter Property="Background" Value="Gray"/>
        <Setter Property="CornerRadius" Value="8, 8, 8, 8"/>
        <Setter Property="Effect">
            <Setter.Value>
                <DropShadowEffect Color="Black" Opacity="0.7" Direction="315" ShadowDepth="8" x:Name="Shadow" BlurRadius="8"/>
            </Setter.Value>
        </Setter>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type local:UObject}">
                    <local:UGrid x:Name="container" Margin="0" RenderTransformOrigin="{TemplateBinding RenderTransformOrigin}">
                        <Border x:Name="shadow" Opacity="0.7" Margin="0" CornerRadius="8, 8, 8, 8">
                            <Border.Background>
                                <SolidColorBrush Color="Transparent" x:Name="BorderColor"/>
                            </Border.Background>
                        </Border>
                        <local:UBorder x:Name="contentBorder" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" 
                                       BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="{TemplateBinding CornerRadius}">
                            <local:UGrid>
                                <local:UContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" 
                                                         VerticalAlignment="{TemplateBinding VerticalContentAlignment}" 
                                                         Content="{TemplateBinding Content}" 
                                                         ContentStringFormat="{TemplateBinding ContentStringFormat}" 
                                                         ContentTemplate="{TemplateBinding ContentTemplate}" Margin="{TemplateBinding Padding}" 
                                                         x:Name="UObjectContent"/>
                            </local:UGrid>
                        </local:UBorder>
                        <Rectangle IsHitTestVisible="False" x:Name="Sheen" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" 
                                   Focusable="False" Opacity="0.6">
                            <Rectangle.Fill>
                                <LinearGradientBrush EndPoint="-0.234,0.37" StartPoint="-0.981,-0.138">
                                    <GradientStop Color="Transparent" Offset="0"/>
                                    <GradientStop Color="#33FFFFFF" Offset="0.52"/>
                                    <GradientStop Color="Transparent" Offset="1"/>
                                </LinearGradientBrush>
                            </Rectangle.Fill>
                        </Rectangle>
                        <Grid x:Name="PART_Stage"/>
                        <Grid>
                            <local:UBorder x:Name="PART_PopupBackgound" Background="Gray" Opacity="0.5" Visibility="Collapsed"/>
                            <Canvas x:Name="PART_PopupStage"/>
                        </Grid>
                    </local:UGrid>
                    <ControlTemplate.Triggers>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsActive" Value="True"/>
                                <Condition Property="ShowsActivationEffects" Value="True"/>
                                <Condition Property="ActivationEffectType" Value="SheenAndBorder"/>
                            </MultiTrigger.Conditions>
                            <MultiTrigger.ExitActions>
                                <BeginStoryboard x:Name="DeactivationTimeline_BeginStoryboard">
                                    <Storyboard>
                                        <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="container" Storyboard.TargetProperty="(UIElement.RenderTransform).(ScaleTransform.ScaleX)">
                                            <SplineDoubleKeyFrame KeyTime="00:00:00" Value="1.03"/>
                                            <SplineDoubleKeyFrame KeySpline="0,0,0.148,0.933" KeyTime="00:00:00.7500000" Value="1.01"/>
                                        </DoubleAnimationUsingKeyFrames>
                                        <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="container" Storyboard.TargetProperty="(UIElement.RenderTransform).(ScaleTransform.ScaleY)">
                                            <SplineDoubleKeyFrame KeyTime="00:00:00" Value="1.03"/>
                                            <SplineDoubleKeyFrame KeySpline="0,0,0.148,0.933" KeyTime="00:00:00.7500000" Value="1.01"/>
                                        </DoubleAnimationUsingKeyFrames>
                                        <ThicknessAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="shadow" Storyboard.TargetProperty="(FrameworkElement.Margin)">
                                            <SplineThicknessKeyFrame KeyTime="00:00:00" Value="-6"/>
                                            <SplineThicknessKeyFrame KeySpline="0,1,1,1" KeyTime="00:00:00.4500000" Value="0"/>
                                        </ThicknessAnimationUsingKeyFrames>
                                        <ColorAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="BorderColor" Storyboard.TargetProperty="(SolidColorBrush.Color)">
                                            <SplineColorKeyFrame KeySpline="0,0,0.15,0.93" KeyTime="00:00:00.4500000" Value="Transparent"/>
                                        </ColorAnimationUsingKeyFrames>
                                        <!--ColorAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="shadow" Storyboard.TargetProperty="(Control.Background)">
                                            <SplineColorKeyFrame KeyTime="00:00:00.7500000" Value="#26000000"/>
                                        </ColorAnimationUsingKeyFrames-->
                                        <PointAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="Sheen" Storyboard.TargetProperty="(Shape.Fill).(LinearGradientBrush.StartPoint)">
                                            <SplinePointKeyFrame KeySpline="0,0,0,0" KeyTime="00:00:00" Value="1.241,0.304"/>
                                            <SplinePointKeyFrame KeySpline="0,0,0.15,0.93" KeyTime="00:00:00.7500000" Value="-0.636,0.132"/>
                                            <SplinePointKeyFrame KeyTime="00:00:00.7750000" Value="-1.146,-0.035"/>
                                        </PointAnimationUsingKeyFrames>
                                        <PointAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="Sheen" Storyboard.TargetProperty="(Shape.Fill).(LinearGradientBrush.EndPoint)">
                                            <SplinePointKeyFrame KeySpline="0,0,0,0" KeyTime="00:00:00" Value="1.879,0.551"/>
                                            <SplinePointKeyFrame KeySpline="0,0,0.15,0.93" KeyTime="00:00:00.7500000" Value="0.018,0.291"/>
                                            <SplinePointKeyFrame KeyTime="00:00:00.7750000" Value="-0.492,0.124"/>
                                        </PointAnimationUsingKeyFrames>
                                    </Storyboard>
                                </BeginStoryboard>
                            </MultiTrigger.ExitActions>
                            <MultiTrigger.EnterActions>
                                <BeginStoryboard x:Name="ActivationTimeline_BeginStoryboard">
                                    <Storyboard>
                                        <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="container" Storyboard.TargetProperty="(UIElement.RenderTransform).(ScaleTransform.ScaleX)">
                                            <SplineDoubleKeyFrame KeyTime="00:00:00" Value="1.01"/>
                                            <SplineDoubleKeyFrame KeySpline="0,1,1,1" KeyTime="00:00:00.4500000" Value="1.03"/>
                                        </DoubleAnimationUsingKeyFrames>
                                        <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="container" Storyboard.TargetProperty="(UIElement.RenderTransform).(ScaleTransform.ScaleY)">
                                            <SplineDoubleKeyFrame KeyTime="00:00:00" Value="1.01"/>
                                            <SplineDoubleKeyFrame KeySpline="0,1,1,1" KeyTime="00:00:00.4500000" Value="1.03"/>
                                        </DoubleAnimationUsingKeyFrames>
                                        <!--DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="shadow" Storyboard.TargetProperty="(0)">
                                            <SplineDoubleKeyFrame KeyTime="00:00:00" Value="0"/>
                                            <SplineDoubleKeyFrame KeySpline="0,1,1,1" KeyTime="00:00:00.4500000" Value="25"/>
                                        </DoubleAnimationUsingKeyFrames-->
                                        <ThicknessAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="shadow" Storyboard.TargetProperty="(FrameworkElement.Margin)">
                                            <SplineThicknessKeyFrame KeySpline="0,0,0.15,0.93" KeyTime="00:00:00.7500000" Value="-6"/>
                                        </ThicknessAnimationUsingKeyFrames>
                                        <ColorAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="BorderColor" Storyboard.TargetProperty="(SolidColorBrush.Color)">
                                            <SplineColorKeyFrame KeyTime="00:00:00" Value="#26000000"/>
                                            <SplineColorKeyFrame KeyTime="00:00:00.4500000" Value="#52000000"/>
                                        </ColorAnimationUsingKeyFrames>
                                        <PointAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="Sheen" Storyboard.TargetProperty="(Shape.Fill).(LinearGradientBrush.StartPoint)">
                                            <SplinePointKeyFrame KeySpline="0,1,1,1" KeyTime="00:00:01.1000000" Value="1.182,0.441"/>
                                        </PointAnimationUsingKeyFrames>
                                        <PointAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="Sheen" Storyboard.TargetProperty="(Shape.Fill).(LinearGradientBrush.EndPoint)">
                                            <SplinePointKeyFrame KeySpline="0,1,1,1" KeyTime="00:00:01.1000000" Value="1.929,0.949"/>
                                        </PointAnimationUsingKeyFrames>
                                    </Storyboard>
                                </BeginStoryboard>
                            </MultiTrigger.EnterActions>
                        </MultiTrigger>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsActive" Value="True"/>
                                <Condition Property="ShowsActivationEffects" Value="True"/>
                                <Condition Property="ActivationEffectType" Value="Sheen"/>
                            </MultiTrigger.Conditions>
                            <MultiTrigger.ExitActions>
                                <BeginStoryboard>
                                    <Storyboard>
                                        <PointAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="Sheen" Storyboard.TargetProperty="(Shape.Fill).(LinearGradientBrush.StartPoint)">
                                            <SplinePointKeyFrame KeySpline="0,0,0,0" KeyTime="00:00:00" Value="1.241,0.304"/>
                                            <SplinePointKeyFrame KeySpline="0,0,0.15,0.93" KeyTime="00:00:00.7500000" Value="-0.636,0.132"/>
                                            <SplinePointKeyFrame KeyTime="00:00:00.7750000" Value="-1.146,-0.035"/>
                                        </PointAnimationUsingKeyFrames>
                                        <PointAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="Sheen" Storyboard.TargetProperty="(Shape.Fill).(LinearGradientBrush.EndPoint)">
                                            <SplinePointKeyFrame KeySpline="0,0,0,0" KeyTime="00:00:00" Value="1.879,0.551"/>
                                            <SplinePointKeyFrame KeySpline="0,0,0.15,0.93" KeyTime="00:00:00.7500000" Value="0.018,0.291"/>
                                            <SplinePointKeyFrame KeyTime="00:00:00.7750000" Value="-0.492,0.124"/>
                                        </PointAnimationUsingKeyFrames>
                                    </Storyboard>
                                </BeginStoryboard>
                            </MultiTrigger.ExitActions>
                            <MultiTrigger.EnterActions>
                                <BeginStoryboard>
                                    <Storyboard>
                                        <ColorAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="BorderColor" Storyboard.TargetProperty="(SolidColorBrush.Color)">
                                            <SplineColorKeyFrame KeyTime="00:00:00" Value="#26000000"/>
                                            <SplineColorKeyFrame KeyTime="00:00:00.4500000" Value="#52000000"/>
                                        </ColorAnimationUsingKeyFrames>
                                        <PointAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="Sheen" Storyboard.TargetProperty="(Shape.Fill).(LinearGradientBrush.StartPoint)">
                                            <SplinePointKeyFrame KeySpline="0,1,1,1" KeyTime="00:00:01.1000000" Value="1.182,0.441"/>
                                        </PointAnimationUsingKeyFrames>
                                        <PointAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="Sheen" Storyboard.TargetProperty="(Shape.Fill).(LinearGradientBrush.EndPoint)">
                                            <SplinePointKeyFrame KeySpline="0,1,1,1" KeyTime="00:00:01.1000000" Value="1.929,0.949"/>
                                        </PointAnimationUsingKeyFrames>
                                    </Storyboard>
                                </BeginStoryboard>
                            </MultiTrigger.EnterActions>
                        </MultiTrigger>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsActive" Value="True"/>
                                <Condition Property="ShowsActivationEffects" Value="True"/>
                                <Condition Property="ActivationEffectType" Value="SheenAndMove"/>
                            </MultiTrigger.Conditions>
                            <MultiTrigger.ExitActions>
                                <BeginStoryboard>
                                    <Storyboard>
                                        <PointAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="Sheen" Storyboard.TargetProperty="(Shape.Fill).(LinearGradientBrush.StartPoint)">
                                            <SplinePointKeyFrame KeySpline="0,0,0,0" KeyTime="00:00:00" Value="1.241,0.304"/>
                                            <SplinePointKeyFrame KeySpline="0,0,0.15,0.93" KeyTime="00:00:00.7500000" Value="-0.636,0.132"/>
                                            <SplinePointKeyFrame KeyTime="00:00:00.7750000" Value="-1.146,-0.035"/>
                                        </PointAnimationUsingKeyFrames>
                                        <PointAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="Sheen" Storyboard.TargetProperty="(Shape.Fill).(LinearGradientBrush.EndPoint)">
                                            <SplinePointKeyFrame KeySpline="0,0,0,0" KeyTime="00:00:00" Value="1.879,0.551"/>
                                            <SplinePointKeyFrame KeySpline="0,0,0.15,0.93" KeyTime="00:00:00.7500000" Value="0.018,0.291"/>
                                            <SplinePointKeyFrame KeyTime="00:00:00.7750000" Value="-0.492,0.124"/>
                                        </PointAnimationUsingKeyFrames>
                                        <ThicknessAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="container" Storyboard.TargetProperty="(FrameworkElement.Margin)">
                                            <SplineThicknessKeyFrame KeyTime="00:00:00.1000000" Value="-2, -2, 2, 2"/>
                                        </ThicknessAnimationUsingKeyFrames>
                                    </Storyboard>
                                </BeginStoryboard>
                            </MultiTrigger.ExitActions>
                            <MultiTrigger.EnterActions>
                                <BeginStoryboard>
                                    <Storyboard>
                                        <ColorAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="BorderColor" Storyboard.TargetProperty="(SolidColorBrush.Color)">
                                            <SplineColorKeyFrame KeyTime="00:00:00" Value="#26000000"/>
                                            <SplineColorKeyFrame KeyTime="00:00:00.4500000" Value="#52000000"/>
                                        </ColorAnimationUsingKeyFrames>
                                        <PointAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="Sheen" Storyboard.TargetProperty="(Shape.Fill).(LinearGradientBrush.StartPoint)">
                                            <SplinePointKeyFrame KeySpline="0,1,1,1" KeyTime="00:00:01.1000000" Value="1.182,0.441"/>
                                        </PointAnimationUsingKeyFrames>
                                        <PointAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="Sheen" Storyboard.TargetProperty="(Shape.Fill).(LinearGradientBrush.EndPoint)">
                                            <SplinePointKeyFrame KeySpline="0,1,1,1" KeyTime="00:00:01.1000000" Value="1.929,0.949"/>
                                        </PointAnimationUsingKeyFrames>
                                        <ThicknessAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="container" Storyboard.TargetProperty="(FrameworkElement.Margin)">
                                            <SplineThicknessKeyFrame KeyTime="00:00:00.1000000" Value="0"/>
                                        </ThicknessAnimationUsingKeyFrames>
                                    </Storyboard>
                                </BeginStoryboard>
                            </MultiTrigger.EnterActions>
                        </MultiTrigger>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsActive" Value="True"/>
                                <Condition Property="ShowsActivationEffects" Value="True"/>
                                <Condition Property="ActivationEffectType" Value="Move"/>
                            </MultiTrigger.Conditions>
                            <MultiTrigger.ExitActions>
                                <BeginStoryboard>
                                    <Storyboard>
                                        <ThicknessAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="container" Storyboard.TargetProperty="(FrameworkElement.Margin)">
                                            <SplineThicknessKeyFrame KeyTime="00:00:00.1000000" Value="-2, -2, 2, 2"/>
                                        </ThicknessAnimationUsingKeyFrames>
                                    </Storyboard>
                                </BeginStoryboard>
                            </MultiTrigger.ExitActions>
                            <MultiTrigger.EnterActions>
                                <BeginStoryboard>
                                    <Storyboard>
                                        <ThicknessAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="container" Storyboard.TargetProperty="(FrameworkElement.Margin)">
                                            <SplineThicknessKeyFrame KeyTime="00:00:00.1000000" Value="0"/>
                                        </ThicknessAnimationUsingKeyFrames>
                                    </Storyboard>
                                </BeginStoryboard>
                            </MultiTrigger.EnterActions>
                        </MultiTrigger>
                        <Trigger Property="IsEnabled" Value="False">
                            <Setter Property="Background" TargetName="contentBorder">
                                <Setter.Value>
                                    <LinearGradientBrush EndPoint="0,0" StartPoint="0,1">
                                        <GradientStop Color="#4CA4B4BD" Offset="0"/>
                                        <GradientStop Color="#4CDFE9EE" Offset="1"/>
                                    </LinearGradientBrush>
                                </Setter.Value>
                            </Setter>
                            <Setter Property="Foreground" Value="#A5333333"/>
                            <Setter Property="BorderBrush" Value="#33000000"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</ResourceDictionary>